Skip to content

remove dead clear_partition for broadcast catalog stores#62

Merged
fabracht merged 3 commits into
mainfrom
remove-broadcast-catalog-clear-partition
May 19, 2026
Merged

remove dead clear_partition for broadcast catalog stores#62
fabracht merged 3 commits into
mainfrom
remove-broadcast-catalog-clear-partition

Conversation

@fabracht
Copy link
Copy Markdown
Contributor

Summary

Follow-up to #61. With schemas and constraints now treated as broadcast state on the export side (every partition snapshot carries the full catalog), the per-partition clear_partition methods on SchemaStore and ConstraintStore are wrong-by-construction — they let a partition wipe drop catalog entries that every node is supposed to hold.

Audit finding before deleting:

  • StoreManager::clear_partition (the aggregator at partition_io.rs:206-224) has zero callers anywhere in the codebase — not production, not tests. Pure dead code.
  • SchemaStore::clear_partition and ConstraintStore::clear_partition are referenced only by their own unit tests (clear_partition_removes_only_target). Nothing in the migration, rebalance, or snapshot paths calls them.
  • import_partition (snapshot.rs:95) does not clear before importing, so the broadcast invariant established by bundle full schema and constraint catalogs in partition snapshots #61 is intact today.

Rather than leaving a comment warning future readers not to wire these into a partition-relinquishment path, this PR removes the footgun outright:

  • Deletes StoreManager::clear_partition (15-line dead aggregator).
  • Deletes SchemaStore::clear_partition + its unit test.
  • Deletes ConstraintStore::clear_partition + its unit test.

Per-partition clear_partition on DataStore, IndexStore, UniqueStore, FkStore, and the MQTT-side stores (sessions, retained, topics, etc.) is unchanged — those are genuinely partition-scoped.

83 deletions, 0 additions, 3 files.

Test plan

  • cargo make clippy — clean (pedantic, all targets + wasm).
  • cargo make format-check — clean.
  • cargo make test — full workspace clean.
  • Pre-commit hook (format-check + clippy) ran on the commit and passed.
  • grep -rn 'clear_partition' across crates/ confirms no residual references to the removed methods.

Depends on

#61 — this PR is conceptually a follow-up; it makes sense regardless of merge order but the motivation comes from the broadcast-catalog model #61 establishes.

@fabracht
Copy link
Copy Markdown
Contributor Author

Coordination with #61

This PR conceptually depends on #61 (broadcast-catalog snapshot export) but the two are mergeable independently — no line-level overlap in the three shared files (constraint_store.rs, schema_store.rs, partition_io.rs):

Auto-merge expected in either order.

Version + CHANGELOG

This PR now carries the mqdb-cluster 0.3.4 → 0.3.5 bump and a CHANGELOG entry covering the dead-code removal. #61 currently does not touch Cargo.toml or CHANGELOG.md.

Recommended merge order: #61 first, then this PR. The CHANGELOG entry references #61 by number and reads naturally in that order.

If #61 should carry the 0.3.5 bump instead: this PR rebases to 0.3.6 and the CHANGELOG entry becomes its own stanza. Trivial swap.

@fabracht fabracht force-pushed the remove-broadcast-catalog-clear-partition branch from 3611fc5 to 518d4f8 Compare May 19, 2026 23:12
@fabracht fabracht merged commit 6c27885 into main May 19, 2026
5 checks passed
@fabracht fabracht deleted the remove-broadcast-catalog-clear-partition branch May 19, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant